<template>
<div>
    <component v-if="exampleModule" :is="exampleModule" :unit-name="unitName"></component>
    <template v-else>
        <!-- <dx-upload type="image" v-model="fileList"></dx-upload> -->
        <!-- <el-button type="text" size="small" @click="getValue">点击</el-button> -->
        <!-- <dx-ctrl :type="ctrlName" v-model.number="form[fieldName]" :clearable="true"></dx-ctrl><el-button type="text" size="small" @click="getValue">点击</el-button> -->
        <dx-summary :unit-name="unitName"
        @tab-click="tabClick" :viewMethod="actionHanle" :label="{searchLabel:'搜索'}"
        :tabs="[{label:'地图模式',name:'map'},{label:'地图模式1',name:'map1'}]">
        <!-- tree-code-type="EMERGENCY_TREE" tree-field-key="parent_id" tree-filter-field-key="emergencyName" :tree-node-method="treeNodeMethod" -->
            <template slot="map">这是地图</template>
            <template slot="map1">这是地图1111</template>
            <!-- <template slot="remark_view_slot" slot-scope="scope">
                <el-form-item label="测试">
                    <el-input v-model="scope.data.form[scope.data.column.columnName]"></el-input>
                </el-form-item>
            </template> -->
            <!-- <template slot-scope="scope" slot="buttonSlot">
                <el-button :key="index" type="text" size="small">修改</el-button>
                {{scope.row}}
            </template> -->
            <!-- <template slot="operationSlot">
                <el-table-column fixed="right" align="center" header-align="center" label="操作">
                    <template slot-scope="scope">
                        <el-button :key="index" type="text" size="small">修改</el-button>
                    </template>
                </el-table-column>
            </template> -->
            <!-- <template slot="appendOperationSlot" slot-scope="scope">
                <el-button type="text" size="small">修改</el-button>
            </template> -->
        </dx-summary>
    </template>
    </div>
</template>
<script>
import DxCtrl from '../../Common/ui/dx-ctrl'
import DxUpload from '../../Common/ui/dx-upload'
import DxSummary from '../../Common/ui/unit/dx-summary'
import http from '../../../assets/js/http.js'
import toolkit from '../../../assets/js/toolkit.js'

export default {

    components : {
        DxSummary,
        DxCtrl,
        DxUpload,
        // MyUnit
    },
    props :{
        unitName : String,
    },
    data(){
        return {
            // fileList : "aa.png,bb.png",
            // form : {
            // },
            exampleModule : null
        }
    },
    methods : {
        actionHanle(){
            // console.log("========>>>>",arguments)
        },
        initData(){
            try{
                let mModule = resolve => require.ensure([], () => resolve(require(`./examples/${this.unitName}.vue`)));
                mModule(scope=>{
                    if(scope){
                        this.exampleModule = mModule;
                    }
                });
            }catch(e){
                console.log(e);
            }
        },
        treeNodeMethod(node){
            return true;
        },
        tabClick({name,queryData}){
            console.log(name);
            console.log(queryData);
        }
    },
    created(){
        this.initData();
 
    },
    mounted(){
        this.routeName = this.$route.name;
        _g.closeGlobalLoading();
    },
    mixins:[http,toolkit]
}
</script>

<style scoped>
@import '../../../assets/css/framework.css';
</style>
